﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Lilium.Control.Reactive
{
    public static class ReactiveExtensions
    {
        public static ISource<TResult> Select<TSource, TResult>(this ISource<TSource> source, Func<TSource, TResult> selector)
        {
            if (source == null) throw new ArgumentNullException("source");

            var result = new Source<TResult>();
            source.Pushed += (TSource value) => result.Push(selector(value));
            return result;
        }
    }
}
